package com.zhs.gccs.view.taskMap;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.zhs.gccs.R;
import com.zhs.gccs.model.CaDict;
import com.zhs.gccs.view.BaseView;

public class GccjTipView extends BaseView {
    private View ll_cjsl;
    private TextView tv_cjsl;
    private View ll_cjff;
    private TextView tv_cjff;
    private View ll_cjpjbz;
    private TextView tv_cjpjbz;

    public GccjTipView(@NonNull Context context) {
        super(context);
    }

    public GccjTipView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public GccjTipView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void init(Context context, AttributeSet attrs, int defStyleAttr) {
        View view = LayoutInflater.from(context).inflate(R.layout.layout_view_gccj_tip, this, true);
//        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomerLogo);
//        String title = typedArray.getString(R.styleable.CustomerInfoItem_preText);
//        typedArray.recycle();
        tv_cjsl = view.findViewById(R.id.tv_cjsl);
        tv_cjff = view.findViewById(R.id.tv_cjff);
        tv_cjpjbz = view.findViewById(R.id.tv_cjpjbz);
        ll_cjsl = view.findViewById(R.id.ll_cjsl);
        ll_cjff = view.findViewById(R.id.ll_cjff);
        ll_cjpjbz = view.findViewById(R.id.ll_cjpjbz);
    }

    public void load(CaDict cjslDict, CaDict cjffDict, CaDict cjpjbzDict) {
        if(cjslDict!=null&& !TextUtils.isEmpty(cjslDict.getDictValue())){
            tv_cjsl.setText(cjslDict.getDictValue());
            ll_cjsl.setVisibility(View.VISIBLE);
        }else {
            tv_cjsl.setText("");
            ll_cjsl.setVisibility(View.GONE);
        }
        if(cjffDict!=null&& !TextUtils.isEmpty(cjffDict.getDictValue())){
            tv_cjff.setText(cjffDict.getDictValue());
            ll_cjff.setVisibility(View.VISIBLE);
        }else {
            tv_cjff.setText("");
            ll_cjff.setVisibility(View.GONE);
        }
        if(cjpjbzDict!=null&& !TextUtils.isEmpty(cjpjbzDict.getDictValue())){
            tv_cjpjbz.setText(cjpjbzDict.getDictValue());
            ll_cjpjbz.setVisibility(View.VISIBLE);
        }else {
            tv_cjpjbz.setText("");
            ll_cjpjbz.setVisibility(View.GONE);
        }
    }
}
